import request from '@/utils/request'

// 查询项目列表
export function listProject(query) {
  return request({
    url: '/pack/project/list',
    method: 'get',
    params: query
  })
}

// 获取项目详情
export function getProject(projectId) {
  return request({
    url: '/pack/project/' + projectId,
    method: 'get'
  })
}

// 新增项目
export function addProject(data) {
  return request({
    url: '/pack/project',
    method: 'post',
    data: data
  })
}

// 修改项目
export function updateProject(data) {
  return request({
    url: '/pack/project/' + data.projectId,
    method: 'put',
    data: data
  })
}

// 删除项目
export function delProject(projectIds) {
  return request({
    url: '/pack/project/' + projectIds,
    method: 'delete'
  })
}

// 增强删除项目
export function delProjectEnhanced(projectId, force = false, cleanupData = false) {
  return request({
    url: '/pack/project/' + projectId + '/enhanced',
    method: 'delete',
    params: {
      force: force,
      cleanupData: cleanupData
    }
  })
}

// 导出项目
export function exportProject(query) {
  return request({
    url: '/pack/project/export',
    method: 'post',
    data: query
  })
}

// 查询项目物料列表
export function listProjectMaterial(projectId, query) {
  return request({
    url: '/pack/project/' + projectId + '/material/list',
    method: 'get',
    params: query
  })
}

// 新增项目物料
export function addProjectMaterial(projectId, data) {
  return request({
    url: '/pack/project/' + projectId + '/material',
    method: 'post',
    data: data
  })
}

// 修改项目物料
export function updateProjectMaterial(projectId, projectMaterialId, data) {
  return request({
    url: '/pack/project/' + projectId + '/material/' + projectMaterialId,
    method: 'put',
    data: data
  })
}

// 删除项目物料
export function delProjectMaterial(projectId, projectMaterialId) {
  return request({
    url: '/pack/project/' + projectId + '/material/' + projectMaterialId,
    method: 'delete'
  })
}

// 查询项目仓库权限列表
export function listProjectWarehouseOperation(projectId, query) {
  return request({
    url: '/pack/project/' + projectId + '/warehouse/operation/list',
    method: 'get',
    params: query
  })
}

// 设置项目仓库权限
export function addProjectWarehouseOperation(projectId, warehouseId, data) {
  return request({
    url: '/pack/project/' + projectId + '/warehouse/' + warehouseId + '/operation',
    method: 'post',
    data: data
  })
}

// 修改项目仓库权限
export function updateProjectWarehouseOperation(projectId, warehouseId, data) {
  return request({
    url: '/pack/project/' + projectId + '/warehouse/' + warehouseId + '/operation',
    method: 'put',
    data: data
  })
}

// 删除项目仓库权限
export function delProjectWarehouseOperation(projectId, warehouseId) {
  return request({
    url: '/pack/project/' + projectId + '/warehouse/' + warehouseId + '/operation',
    method: 'delete'
  })
} 